package com.IR.fenxiao.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.IR.fenxiao.service.BDistributionBiz;
import com.IR.shop.po.Distribution;

import net.sf.json.JSONArray;

@Controller
public class BDistributionAction {
	@Resource
	private BDistributionBiz biz;
	private List<Distribution> list;
	public List<Distribution> getList() {
		return list;
	}
	public void setList(List<Distribution> list) {
		this.list = list;
	}
	@RequestMapping(value="findDisOneDown.do")	
	public void findDisOneDown(HttpServletRequest request,HttpServletResponse response) throws IOException {
		response.setHeader("Access-Control-Allow-Origin", "*");
		response.setCharacterEncoding("utf-8");
		Long did=new Long(request.getParameter("did"));
		list=biz.findDisOneDown(did);
		//System.out.println(list.size());
		PrintWriter out = response.getWriter();
		String str=JSONArray.fromObject(list).toString();
		out.println(str);
	}
	@RequestMapping(value="findDisTwoDown.do")	
	public void findDiTwoDown(HttpServletRequest request,HttpServletResponse response) throws IOException {
		response.setHeader("Access-Control-Allow-Origin", "*");
		response.setCharacterEncoding("utf-8");
		Long did=new Long(request.getParameter("did"));
		list=biz.findDisTwoDown(did);
		PrintWriter out = response.getWriter();
		String str=JSONArray.fromObject(list).toString();
		out.println(str);
	}
}
